yum install mariadb-server -y
mysqladmin password 'lzy123.com' && echo -e "\E[1;32m 创建的密码为lzy123.com \E[0m"
color () {
    RES_COL=60
    MOVE_TO_COL="echo -en \\033[${RES_COL}G"
    SETCOLOR_SUCCESS="echo -en \\033[1;32m"
    SETCOLOR_FAILURE="echo -en \\033[1;31m"
    SETCOLOR_WARNING="echo -en \\033[1;33m"
    SETCOLOR_NORMAL="echo -en \E[0m"
    echo -n "$1" && $MOVE_TO_COL
    echo -n "["
    if [ $2 = "success" -o $2 = "0" ] ;then
        ${SETCOLOR_SUCCESS}
        echo -n $"  OK  "    
    elif [ $2 = "failure" -o $2 = "1"  ] ;then 
        ${SETCOLOR_FAILURE}
        echo -n $"FAILED"
    else
        ${SETCOLOR_WARNING}
        echo -n $"WARNING"
    fi
    ${SETCOLOR_NORMAL}
    echo -n "]"
    echo 
}
start_mariadbservice () {
    systemctl enable mariadb
    systemctl restart mariadb
    systemctl is-active mariadb
    if [ $? -eq 0 ] ;then
        color "mariadb 安装成功!" 0     
    else
        color "mariadb 服务安装失败!" 1
    exit 1
    fi
}
start_mariadbservice